function onBeforeRequest(details)
{
	var domainRegEx = /^([^:]+:\/\/)([^\/]+)/;
	var domain = details.url.match(domainRegEx)[2];
	if(KnownDomains.indexOf(domain) != -1 && 
		domain != Options.Domain.Current)
		return {redirectUrl:details.url.replace(domainRegEx, "$1" + 
			Options.Domain.Current)};
}

Options.Domain.onChanged = (function(details)
{
	if(details.newValue)
		chrome.webRequest.onBeforeRequest.addListener(onBeforeRequest, 
			{urls: DomainMatchPatterns}, ["blocking"]);
	else
		chrome.webRequest.onBeforeRequest.removeListener(onBeforeRequest);
});

if(Options.Domain.AutoDetect)
{
	//TODO: Check for domain
}

Options.Domain.Force && Options.Domain.onChanged(
	{name: "Force", newValue: true});

